<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="description" content="Description" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, minimum-scale=1.0"
    />
    <link
      rel="stylesheet"
      href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css"
    />
  </head>
  <body>
    <nav>
      <a href="#/">EN</a>
      <a href="#/zh-cn/">中文</a>
    </nav>
    <div id="app"></div>
    <script>
      window.$docsify = {
        name: '',
        repo: '',
        // loadSidebar: true,
        // 开启导航栏,加载_navbar.md
        loadNavbar: true,
        // 开启封面,加载_coverpage.md
        coverpage: true,
      };
    </script>
    <!-- Docsify v4 -->
    <script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
  </body>
</html>
<script>
  setTimeout(() => {
    var navEle = document.getElementsByTagName('nav');
    console.log(navEle);
    var themes_a = navEle[0].children[0].children[2];
    // console.log(themes_a);
    var link_themes = document.getElementsByTagName('link');
    console.log(link_themes[0]);
    var url = './themes/dark.css';
    var link = document.createElement('link');
    link.setAttribute('rel', 'stylesheet');
    link.setAttribute('type', 'text/css');
    link.setAttribute('href', url);
    link.setAttribute('id', 'link_drak');
    // document.getElementsByTagName('head')[0].appendChild(link);
    let isDrak = false;

    themes_a.onclick = () => {
      if (isDrak) {
        var link_drak = document.getElementById('link_drak');
        document.head.removeChild(link_drak);
        isDrak = false;
      } else {
        console.log('暗黑模式');
        document.head.appendChild(link);
        isDrak = true;
      }
    };
  }, 1000);
</script>
